package nc.impl.mmpac.sumpickm;

import nc.bs.mmpac.sumpickm.bp.SumPickmComputeBP;
import nc.bs.mmpac.sumpickm.bp.SumPickmFinishBP;
import nc.bs.mmpac.sumpickm.bp.SumPickmIssueBP;
import nc.bs.mmpac.sumpickm.bp.SumPickmSumBP;
import nc.bs.mmpac.sumpickm.bp.SumPickmUnFinishBP;
import nc.itf.mmpac.sumpickm.ISumPickmBusinessService;
import nc.jdbc.framework.generator.SequenceGenerator;
import nc.ui.querytemplate.querytree.IQueryScheme;
import nc.vo.mmpac.pickm.entity.AggPickmVO;
import nc.vo.mmpac.sumpickm.entity.AggSumPickmVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class SumPickmBusinessServiceImpl implements ISumPickmBusinessService {
    @Override
    public AggSumPickmVO[] sum(AggSumPickmVO[] aggVOs) throws BusinessException {
        SumPickmSumBP bp = new SumPickmSumBP();
        return bp.sum(aggVOs);
    }

    @Override
    public AggSumPickmVO[] unSum(AggSumPickmVO[] aggVOs) throws BusinessException {
        return null;
    }

    @Override
    public AggSumPickmVO[] issue(AggSumPickmVO[] aggVOs) throws BusinessException {
        SumPickmIssueBP bp = new SumPickmIssueBP();
        return bp.issue(aggVOs);
    }

    @Override
    public AggSumPickmVO[] finish(AggSumPickmVO[] aggVOs) throws BusinessException {
        try {

            SumPickmFinishBP bp = new SumPickmFinishBP();
            return bp.finish(aggVOs);
        }
        catch (Exception ex) {
            ExceptionUtils.marsh(ex);
        }
        return null;
    }

    @Override
    public AggSumPickmVO[] unFinish(AggSumPickmVO[] aggVOs) throws BusinessException {
        try {

            SumPickmUnFinishBP bp = new SumPickmUnFinishBP();
            return bp.unFinish(aggVOs);
        }
        catch (Exception ex) {
            ExceptionUtils.marsh(ex);
        }
        return null;
    }

    @Override
    public AggSumPickmVO[] toSumPickms(AggPickmVO[] aggVOs) throws BusinessException {
        return null;
    }

    @Override
    public AggSumPickmVO[] compute(AggSumPickmVO[] aggVOs, IQueryScheme queryScheme) throws BusinessException {

        SumPickmComputeBP bp = new SumPickmComputeBP();
        return bp.compute(aggVOs, queryScheme);

    }

	@Override
	public String genKey() throws BusinessException {
		
		return  new SequenceGenerator().generate();
	}

}
